<%@ page language="java" contentType="text/html; charset=utf-8"
         pageEncoding="utf-8" %>
<%@taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@taglib uri="http://shiro.apache.org/tags" prefix="shiro" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>软途纺织管理平台</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="plugins/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" href="css/global.css" media="all">
    <link rel="stylesheet"
          href="plugins/font-awesome/css/font-awesome.min.css">
    <script type="text/javascript" src='myjs/layer.js'></script>
    <script type="text/javascript" src='js/jquery-3.1.1.min.js'></script>
    <script type="text/javascript" src="myjs/path.js"></script>
    <script type="text/javascript">
        function openadd() {
            layer.open({
                type: 1,
                //加上边框
                area: ['350px', '230px'], //宽高
                btn: true,
                content: $('#aa'),
            });
        }
        function closeadd() {
            CZ()
            layer.closeAll()
        }
        /**
         重置
         */
        function CZ() {
            $('#newpassword').val('')
            $('#newpassword1').val('')
            $('#oldpassword').val('')
            $('#newpassword').css('border-color', '#E6E6E6')
            $('#newpassword1').css('border-color', '#E6E6E6')
            $('#oldpassword').css('border-color', '#E6E6E6')
            $('#newpassword').attr('placeholder', '请输入新密码')
            $('#newpassword1').attr('placeholder', '重输新密码')
            $('#oldpassword').attr('placeholder', '请输入旧密码')
        }
    </script>
</head>
<body>
<div class="layui-layout layui-layout-admin"
     style="border-bottom: solid 5px #1aa094;">
    <div class="layui-header header header-demo">
        <div class="layui-main">
            <div class="admin-login-box">
                <a class="logo" style="left: 0; top: 8px;" href="#"> <img
                        src="images/bbqqlogo.jpg">
                </a>
                <div class="admin-side-toggle">
                    <i class="fa fa-bars" aria-hidden="true"></i>
                </div>
                <div class="admin-side-full">
                    <i class="fa fa-life-bouy" aria-hidden="true"></i>
                </div>
            </div>
            <ul class="layui-nav admin-header-item">
                <li class="layui-nav-item"><a href="javascript:;"
                                              class="admin-header-user"> <img src="images/a.jpg"/>
                    <span>${info.nikeName}</span>
                    <input id='jgid' type='hidden' value='${info.jgid}'>
                    <input id='jgleixing' type='hidden' value='${info.jgleixing}'>
                    <input id='username' type='hidden' value='${info.nikeName}'>
                    <input id='userid' type='hidden' value='${info.id}'>
                    <input id='parentId' type='hidden' value='${info.parentId}'>
                </a>
                    <dl class="layui-nav-child">
                        <dd>
                            <a href="javascript:openadd()"><i class="fa fa-user-circle"
                                                              aria-hidden="true"></i> 修改密码</a>
                        </dd>
                        <dd>
                            <a href="/erp/user/loginout.do"><i
                                    class="fa fa-sign-out" aria-hidden="true"></i> 安全退出</a>
                        </dd>
                    </dl>
                </li>
            </ul>
            <ul class="layui-nav admin-header-item-mobile">
                <li class="layui-nav-item"><a href="logout.do"><i
                        class="fa fa-sign-out" aria-hidden="true"></i> 注销</a></li>
            </ul>
        </div>
    </div>
    <div class="layui-side layui-bg-black" id="admin-side">
        <div class="layui-side-scroll" id="admin-navbar-side"
             lay-filter="side"></div>
    </div>
    <div class="layui-body"
         style="bottom: 0; border-left: solid 2px #1AA094;" id="admin-body">
        <div class="layui-tab admin-nav-card layui-tab-brief"
             lay-filter="admin-tab">
            <ul class="layui-tab-title">
                <li class="layui-this"><i class="fa fa-dashboard"
                                          aria-hidden="true"></i> <cite>首页</cite></li>
            </ul>
            <div class="layui-tab-content"
                 style="min-height: 150px; padding: 5px 0 0 0;">
                <div class="layui-tab-item layui-show">
                    <iframe src="main.jsp"></iframe>
                </div>
            </div>
        </div>
    </div>
    <div class="layui-footer footer footer-demo" id="admin-footer">
        <div class="layui-main">
            <p>
                2017 &copy; <a href="http://www.roador.net/">南京软途信息</a>
            </p>
        </div>
    </div>
    <div class="site-tree-mobile layui-hide">
        <i class="layui-icon">&#xe602;</i>
    </div>
    <div class="site-mobile-shade"></div>

    <!--锁屏模板 start-->
    <script type="text/template" id="lock-temp">
        <div class="admin-header-lock" id="lock-box">
            <div class="admin-header-lock-img">
                <img src="images/a.jpg"/>
            </div>
            <div class="admin-header-lock-name" id="lockUserName">beginner</div>
            <input type="text" class="admin-header-lock-input" value="输入密码解锁.." name="lockPwd" id="lockPwd"/>
            <button class="layui-btn layui-btn-small" id="unlock">解锁</button>
        </div>
    </script>
    <!--锁屏模板 end -->

    <script type="text/javascript" src="plugins/layui/layui.js"></script>

    <!--这里使用权限管理获取json数据-->
    <!-- <script type="text/javascript" src="/datas/nav.js"></script> -->

    <script type="text/javascript">

        var navs = [
                <shiro:hasPermission name="user:look">
                {
                    "title": "系统管理",
                    "icon": "fa-bank",
                    "spread": false,
                    "children": [
                        <shiro:hasPermission name="jigou:look">
                        {
                            "title": "机构管理",
                            "icon": "fa-navicon",
                            "href": "jigou.jsp?jgid=" + $('#jgid').val(),
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="role:look">
                        {
                            "title": "角色管理",
                            "icon": "fa-navicon",
                            "href": "role.jsp?jgid=" + $('#jgid').val(),
                        },
                        </shiro:hasPermission>

                        <shiro:hasPermission name="user:look">
                        {
                            "title": "用户管理",
                            "icon": "fa-navicon",
                            "href": "user.jsp?jgid=" + $('#jgid').val(),
                        }
                        </shiro:hasPermission>
                    ]
                },
                </shiro:hasPermission>
                <shiro:hasPermission name="production:look">
                {
                    "title": "基础信息",
                    "icon": "fa-home",
                    "spread": false,
                    "children": [{
                        "title": "产品详细信息",
                        "icon": "fa-navicon",
                        "href": "production.jsp?jgid=" + $('#jgid').val(),
                    }
                    ]
                },
                </shiro:hasPermission>
                <shiro:hasPermission name="vip:look">
                {
                    "title": "往来单位",
                    "icon": "&#xe613",
                    "href": "",
                    "spread": false,
                    "children": [
                        <shiro:hasPermission name="pfs:look">
                        {
                            "title": "批发商",
                            "icon": "&#xe612",
                            "href": "pifashang.jsp?jgid=" + $('#jgid').val()
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="gys:look">
                        {
                            "title": "供应商",
                            "icon": "&#xe612",
                            "href": "gongyingshang.jsp"
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="vip:look">
                        {
                            "title": "会员管理",
                            "icon": "&#xe612",
                            "href": "vip.jsp?jgid=" + $('#jgid').val(),
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="vipcard:look">
                        {
                            "title": "会员卡收支明细",
                            "icon": "fa-navicon",
                            "href": "chongzhi.jsp?jgid=" + $('#jgid').val(),
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="vipzk:look">
                        {
                            "title": "零售折扣策略",
                            "icon": "fa-navicon",
                            "href": "saleseason.jsp",
                        }
                        </shiro:hasPermission>
                    ]
                },
                </shiro:hasPermission>
                <shiro:hasPermission name="cj:look">
                {
                    "title": "裁剪管理",
                    "icon": "fa-scissors ",
                    "spread": false,
                    "children": [{
                        "title": "裁剪",
                        "icon": "fa-navicon",
                        "href": "tailor.jsp"

                    }]
                },
                </shiro:hasPermission>
                <shiro:hasPermission name="ruku:look">
                {
                    "title": "入库管理",
                    "icon": "&#x1002;",
                    "spread": false,
                    "children": [
                        {
                            "title": "入库",
                            "icon": "fa-navicon",
                            "href": "ruku.jsp?jgid=" + $('#jgid').val() + "&jgleixing=" + $('#jgleixing').val() + "&parentId=" + $('#parentId').val()
                        },
                        {
                            "title": "入库退货",
                            "icon": "fa-navicon",
                            "href": "rukuback.jsp?jgid=" + $('#jgid').val() + "&jgleixing=" + $('#jgleixing').val() + "&parentId=" + $('#parentId').val()
                        }
                    ]
                },
                </shiro:hasPermission>
                <shiro:hasPermission name="chuku:look">
                {
                    "title": "销售管理",
                    "icon": "&#x1002;",
                    "spread": false,
                    "children": [
                        <shiro:hasPermission name="chuku:look">
                        {
                            "title": "批发出库",
                            "icon": "fa-navicon",
                            "href": "pifa.jsp?jgid=" + $('#jgid').val()
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="chuku:look">
                        {
                            "title": "分销出库",
                            "icon": "fa-navicon",
                            "href": "fenxiao.jsp?jgid=" + $('#jgid').val() + "&jgleixing=" + $('#jgleixing').val() + "&parentId=" + $('#parentId').val()
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="chuku:look">
                        {
                            "title": "销售退货",
                            "icon": "fa-navicon",
                            "href": "pifatuihuo.jsp?jgid=" + $('#jgid').val()
                        }
                        </shiro:hasPermission>

                    ]
                },
                </shiro:hasPermission>
                <shiro:hasPermission name="store:look">
                {
                    "title": "库存",
                    "icon": "fa-cubes",
                    "href": "#",
                    "spread": false,
                    "children": [{
                        "title": "查询库存",
                        "icon": "fa-navicon",
                        "href": "store.jsp?jgid=" + $('#jgid').val()
                    },
                        <shiro:hasPermission name="store:pandian">
                        {
                            "title": "库存盘点",
                            "icon": "fa-navicon",
                            "href": "pandian.jsp?jgid=" + $('#jgid').val() + "&userid=" + $('#userid').val() + "&userName=" + $('#username').val()
                        }
                        </shiro:hasPermission>
                    ]
                },
                </shiro:hasPermission>
                <shiro:hasPermission name="finance:zongzhang">
                {
                    "title": "财务",
                    "icon": "fa-stop-circle",
                    "href": "",
                    "spread": false,
                    "children": [
                        <shiro:hasPermission name="finance:zongzhang">
                        {
                            "title": "账期",
                            "icon": "fa-navicon",
                            "href": "finance/financeperiod.jsp?jgid=" + $('#jgid').val() + "&index=0&username=" + $('#username').val() + "&userid=" + $('#userid').val()
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="finance:zongzhang">
                        {
                            "title": "总账",
                            "icon": "fa-navicon",
                            "href": "finance/finance.jsp?jgid=" + $('#jgid').val() + "&index=0&username=" + $('#username').val() + "&userid=" + $('#userid').val()
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="finance:szjl">
                        {
                            "title": "收支记录",
                            "icon": "fa-navicon",
                            "href": "finance/financetransaction.jsp?jgid=" + $('#jgid').val() + "&jgleixing=" + $('#jgleixing').val() + "&parentId=" + $('#parentId').val()
                        }
                        </shiro:hasPermission>
                        <shiro:hasPermission name="szjl:look">
                        /* {
                         "title": "对账单",
                         "icon": "fa-navicon",
                         "href": "finance/financeAccount.jsp?jgid=" + $('#jgid').val() + "&jgleixing=" + $('#jgleixing').val()+ "&parentId=" + $('#parentId').val()
                         }*/
                        </shiro:hasPermission>
                    ]
                },
                </shiro:hasPermission>
                {
                    "title": "报表",
                    "icon": "fa-th-list",
                    "href": "",
                    "spread": false,
                    "children": [
                     <shiro:hasPermission name="cj:look">
                        {
                            "title": "裁剪报表",
                            "icon": "fa-navicon",
                            "href": "tailorreport.jsp?jgid=" + $('#jgid').val() + "&index=0&username=" + $('#username').val() + "&userid=" + $('#userid').val()

                        }, </shiro:hasPermission>
                            <shiro:hasPermission name="store:look">
                        {
                            "title": "库存报表",
                            "icon": "fa-navicon",
                            "href": "storereport.jsp?jgid=" + $('#jgid').val() + "&index=0&username=" + $('#username').val() + "&userid=" + $('#userid').val()
                        },</shiro:hasPermission>
                           <shiro:hasPermission name="chuku:look">
                        {
                            "title": "销售报表",
                            "icon": "fa-navicon",
                            "href": "xiaoshou_report.jsp?jgid=" + $('#jgid').val()
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="ruku:look">
                        {
                            "title": "入库月表",
                            "icon": "fa-navicon",
                            "href": "rukuyue_report.jsp?jgid=" + $('#jgid').val() + "&index=0&username=" + $('#username').val() + "&userid=" + $('#userid').val()
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="ruku:look">
                        {
                            "title": "入库报表",
                            "icon": "fa-navicon",
                            "href": "ruku_report.jsp?jgid=" + $('#jgid').val() + "&index=0&username=" + $('#username').val() + "&userid=" + $('#userid').val()
                        },
                        </shiro:hasPermission>
                        <shiro:hasPermission name="finance:zongzhang">
                        {
                            "title": "总账报表",
                            "icon": "fa-navicon",
                            "href": "finance/financeReport.jsp?jgid=" + $('#jgid').val()
                        }, </shiro:hasPermission>

                        <shiro:hasPermission name="finance:zongzhang">
                        {
                            "title": "对账单",
                            "icon": "fa-navicon",
                            "href": "finance/financeAccount.jsp?jgid=" + $('#jgid').val()
                        }, </shiro:hasPermission>

                    ]
                }
            ]
        ;
    </script>

    <script src="js/index.js"></script>
    <script>
        layui.use('layer', function () {
            var $ = layui.jquery,
                layer = layui.layer;

            $('#video1').on('click', function () {
                layer.open({
                    title: 'YouTube',
                    maxmin: true,
                    type: 2,
                    content: 'video.html',
                    area: ['800px', '500px']
                });
            });
            $('#pay').on('click', function () {
                layer.open({
                    title: false,
                    type: 1,
                    content: '<img src="/images/xx.png" />',
                    area: ['500px', '250px'],
                    shadeClose: true
                });
            });


        });
    </script>
</div>


<div id='aa' class="layui-input-inline"
     style="display: none; margin: 10px 20px">
    <table cellspacing="5" cellpadding="5">
        <tr style="margin-top: 10px">
            <td>请输入旧密码 ：</td>
            <td><input id='oldpassword' type="password" name="password"
                       lay-verify="pass" placeholder="请输入旧密码" autocomplete="off"
                       class="layui-input" onblur="YZ1()"></td>
        </tr>
        <tr style="margin-top: 10px">
            <td>请输入新密码 ：</td>
            <td><input id='newpassword' type="password" name="password"
                       lay-verify="pass" placeholder="请输入新密码" autocomplete="off"
                       class="layui-input" onblur="YZ2()"></td>
        </tr>
        <tr style="margin-top: 10px">
            <td>重新入新密码 ：</td>
            <td><input id='newpassword1' type="password" name="password"
                       lay-verify="pass" placeholder="重输新密码" autocomplete="off"
                       class="layui-input" onblur="YZ3()"></td>
        </tr>
        <tr style="margin-top: 10px">
            <td>
                <button class="layui-btn layui-btn-primary layui-btn-small"
                        onclick="CZ()">重置
                </button>
            </td>
            <td colspan="2" style="text-align: right;">
                <button class="layui-btn layui-btn-small" onclick="xiu()">确定</button>
                <button id="btn"
                        class="layui-btn layui-btn-primary layui-btn-small" style="">
                    <a href="javascript:closeadd()">取消</a>
                </button>
            </td>
        </tr>


    </table>

</div>


</body>
<script type="text/javascript">
    if ('${info.userName}' == null || '${info.userName}' == '') {
        window.location.href = path+"/bbqq/login.jsp";
    }
    function xiu() {
        if (YZ1() & YZ2() & YZ3())
            $.ajax({

                url: path+'/user/updataPassWord.do',
                type: 'post',
                data: {
                    oldpwd: $('#oldpassword').val(),
                    newpwd: $('#newpassword').val(),
                },
                dataType: 'json',
                success: function (data) {

                    if (data.code == 0) {

                        location.href = path+"/user/loginout.do";

                    } else {
                        $('#oldpassword').val('')
                        $('#oldpassword').css('border-color', 'red');
                        $('#oldpassword').attr('placeholder', data.msg)

                    }

                }, error: function () {

                }

            })


    }


    //验证


    function YZ1() {

        if ($('#oldpassword').val() == '') {

            $('#oldpassword').css('border-color', 'red')
            $('#oldpassword').attr('placeholder', '此项不能为空')
            return false
        } else {


            $('#oldpassword').css('border-color', 'green')
            return true

        }


    }

    function YZ2() {

        if ($('#newpassword').val() == '') {

            $('#newpassword').css('border-color', 'red')
            $('#newpassword').attr('placeholder', '此项不能为空')
            return false
        } else {
            if ($('#newpassword').val().length < 6) {
                $('#newpassword').val('')
                $('#newpassword').css('border-color', 'red')
                $('#newpassword').attr('placeholder', '新密码不能小于6位')
                return false


            } else {
                $('#newpassword').css('border-color', 'green')
                return true

            }


        }

    }


    function YZ3() {


        if ($('#newpassword1').val() == '') {

            $('#newpassword1').css('border-color', 'red')
            $('#newpassword1').attr('placeholder', '此项不能为空')
            return false
        } else {


            if ($('#newpassword1').val() != $('#newpassword').val()) {
                $('#newpassword1').val('')
                $('#newpassword1').css('border-color', 'red')
                $('#newpassword1').attr('placeholder', '密码不一致')
                return false
            } else {
                $('#newpassword1').css('border-color', 'green')
                return true
            }
        }
    }
</script>
</html>


